import { createRouter, createWebHashHistory } from 'vue-router';
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);

console.log('>>>>>>>>>> 当前环境 ', import.meta.env.VITE_APP_INCLUDE_TEST_PAGE, isMobile);

const isIncludeTestPage = import.meta.env.VITE_APP_INCLUDE_TEST_PAGE == '1';

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      component: () => import(isMobile ? '../views/mobile/mobile.vue' : '../views/pc/pc.vue')
    },
    {
      path: '/pc',
      name: 'pc',
      component: () => import('../views/pc/pc.vue')
    },
    {
      path: '/mobile',
      name: 'mobile',
      component: () => import('../views/mobile/mobile.vue')
    },
    ...(isIncludeTestPage
      ? [
          {
            path: '/login',
            name: 'login',
            component: () => import('../views/login/login.vue')
          }
        ]
      : [])
  ]
});

export default router;
